const LodashModuleReplacementPlugin = require("lodash-webpack-plugin");
const path  =require("path");
module.exports = {
  runtimeCompiler:true,
  css: {
    loaderOptions: {
      less: {
        modifyVars: {
          "primary-color": "#3b77e3",
          "link-color": "#3b77e3",
          "border-radius-base": "2px",
        },
        javascriptEnabled: true,
      },
    },
  },
  chainWebpack: (config) => {
    config.resolve.alias
        .set('@', path.resolve(__dirname, './src'))
    if (process.env.NODE_ENV === "production") {
       config.plugin("loadshReplace").use(new LodashModuleReplacementPlugin());
    }
   },
  devServer: {
    // host: 'localhost',
    port: 8090, //项目运行的端口号
    open: false, //配置自动启动浏览器
    proxy: {
      "/api": {
        target: "http://127.0.0.1:8080", //对应服务端的接口地址
        // target: "http://172.16.10.60:1200", //对应服务端的接口地址
        changeOrigin: true, // 开启跨域
        ws: true,
        pathRewrite: {
          "^/api": "/"
        }
      }
    }
  }
};
